
#ifndef GISAO_ADAPTOR_H
#define GISAO_ADAPTOR_H

#include <stdint.h>
#include "c2cplatform/library/basic/singleton_t.h"
#include "libc2c/byte_stream.h"
#include "app_platform/help_macros.h"
#include "app_platform/intf_svc.h"
#include "intf_service.h"
#include "gisao.h"

using namespace erp::gis::ao;

/**
 * @class CGisAoService
 * @brief Service与Container接口类
 */
class CGisAoService : public ISvc
{
public:
    CGisAoService(uint32_t dwcmdId);
	
public:
    virtual int Execute(CCmdObj& oCmd);  
    virtual void Reset();
    virtual void getCmdIdRange(uint32_t& dwcmdIdBegin, uint32_t& dwcmdIdEnd) const;

private:
		int GetIpAddressByIp(CCmdObj& oCmd);
		int GetSmallestRegionByIp(CCmdObj& oCmd);
private:
	uint32_t m_dwcmdId;
    CGisAo* m_pSvc;
};

/**
 * @class CGisAoSvcFactory
 * @brief 生成Service的工厂
 */
class CGisAoSvcFactory : public ISvcFactory
{
    DECLARE_SINGLETON(CGisAoSvcFactory, CDummyLock)
public:	
    virtual uint32_t getCateId() const;
    virtual int init(void* pvParam = NULL);
    virtual int fini(void* pvParam = NULL);
    virtual void getServiceType(ServiceTypeMap_T& mapSvcType);
    virtual IService* createService(uint32_t dwcmdId);
    
private:
	struct CXYZTimerHandler : public IUserTimerHandler
	{   
		virtual int OnTimer(int iTimerId);
	};
	CXYZTimerHandler m_oTimerHandler;
};

typedef CSingletonT<CGisAoSvcFactory, CDummyLock> CSvcFactorySingleton;

#endif /* GISAO_ADAPTOR_H */
